#!/bin/bash -
#=======================================================================
#
#          FILE: arp_flux_fix.sh
#         USAGE: ./arp_flux_fix.sh
#   DESCRIPTION: Fix ARP flux problem script
#  REQUIREMENTS: arp(8)
#          BUGS: N/A
#         NOTES: N/A
#        AUTHOR: Ali Ayoub
#         EMAIL: ali@mellanox.com
#       COMPANY: N/A
#       CREATED: 09.17.2010-15:37:45
#      REVISION: 1.0
#=======================================================================

# Orig values
# echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore
# echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce

# checks
if [ $UID -ne 0 ]; then
        echo "-E- You must be root to run this script"
        exit 10
elif ! [ -f /proc/sys/net/ipv4/conf/all/arp_ignore ]; then
        echo "-E- File not found: /proc/sys/net/ipv4/conf/all/arp_ignore"
        exit 11
elif ! [ -f /proc/sys/net/ipv4/conf/all/arp_announce ]; then
	echo "-E- /proc/sys/net/ipv4/conf/all/arp_announce"
	exit 12
fi


arp_ignore=`cat /proc/sys/net/ipv4/conf/all/arp_ignore`
arp_announce=`cat /proc/sys/net/ipv4/conf/all/arp_announce`

echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "/proc/sys/net/ipv4/conf/all/arp_ignore: $arp_ignore => 1"

echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
echo "/proc/sys/net/ipv4/conf/all/arp_announce: $arp_announce => 2"


